if(isNil "EnablePXSsatcom") then {EnablePXSsatcom = 1;};
if (EnablePXSsatcom == 0) exitwith {diag_log format["MSO-%1 PXS SATCOMs turned off! Exiting...", time]};

private["_unit","_switch"];

//init: [unitName, activeStatus] execVM "tmf\support\modules\pxs_satcom_oa\init_satellite.sqf";
//activeStatus: "ON" ; "OFF"
_switch = _this select 0;

//start functions
PXS_timeFunction = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\time_function.sqf";
PXS_timeView = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\time_view.sqf";
PXS_coordinatesView = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\coordinates_view.sqf";
PXS_adjustCamera = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\adjustCamera.sqf";
PXS_updateCamera = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\updateCamera.sqf";
PXS_closeCamera = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\closeCamera.sqf";
PXS_viewSatellite = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\view_satellite.sqf";
PXS_keyEventFunction = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\key_function.sqf";
PXS_mouseZChanged = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\mouseZChanged.sqf";
PXS_keyMain = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\key_main.sqf";
PXS_switcher = compile preprocessFileLineNumbers "tmf\support\modules\pxs_satcom_oa\switcher.sqf";

if (isserver) then {
    //switch on or off globally (can be disabled for all with this switch)
	[_switch] call PXS_switcher;
};
//create menu item
if (!isDedicated && hasInterface) then {
	if (isNil "TYR_MENU_IsActive" || {TYR_MENU_IsActive <= 0}) then {
		["PXS Satellite Comms","if ((call mso_fnc_hasRadio) && ([(getPlayerUID player),['leader','admin']] call mp_rights_fnc_hasRoles)) then { call compile preprocessfilelinenumbers 'tmf\support\modules\pxs_satcom_oa\start_satellite.sqf'}"] call mso_core_fnc_updateMenu;
		["player", [mso_interaction_key], -9398, ["tmf\support\modules\pxs_satcom_oa\fn_menuDef.sqf", "main"]] call CBA_ui_fnc_add;
	} else {
		if (!isnil "tyr_fnc_addHandler") then {
			["TYRMENU",
				[[
					"PXS Satellite Comms"
					,{[(getPlayerUID player),['leader','admin','satellite']] call mp_rights_fnc_hasRoles}
					,{call compile preprocessfilelinenumbers "tmf\support\modules\pxs_satcom_oa\start_satellite.sqf"}
					,"tmf\support\modules\pxs_satcom_oa\satellite.paa"
				]]
			] call tyr_fnc_addHandler;
		};
	};
};